home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 476-500 / disk_488 / lordofhosts / lohsrc.lzh / Lord.h < prev    next >
C/C++ Source or Header  |  1991-05-10  |  4KB  |  156 lines

  1. /* LORD OF HOSTS - Lord.h --- Headerdatei */
  2.  
  3. #include <functions.h>
  4. #include <exec/types.h>
  5. #include <exec/interrupts.h>
  6. #include <devices/input.h>
  7. #include <devices/inputevent.h>
  8. #include <devices/gameport.h>
  9. #include <intuition/intuition.h>
  10. #include <graphics/gfxbase.h>
  11. #include <stdlib.h>
  12. #include "req.h"
  13. #include "reqbase.h"
  14. #include    <libraries/dosextens.h>
  15. #include <stdio.h>
  16. #include <stddef.h>
  17. #include <errno.h>
  18. #include <string.h>
  19.  
  20. struct Piece
  21. {
  22.    int Number;
  23.    int ID;           /* R/WKING || R/WKNIGHT */
  24.    int Value;
  25.    UBYTE x,y;
  26.    BOOL StillAlive;
  27. };
  28.  
  29. struct Move
  30. {
  31.    UBYTE fromx,fromy;
  32.    UBYTE tox,toy;
  33.    int   Beaten;
  34.    BOOL  x_first;
  35.    BOOL  GameOver;
  36.    int status;
  37. };
  38.  
  39. #define VERSION "1.0"
  40. /* für Zugriff auf das Feld Pieces[4] */
  41. #define RKING 0
  42. #define WKING 1
  43. #define RKNIGHT 2
  44. #define WKNIGHT 3
  45. /* JoyMouse */
  46. #define SPEED 5
  47. /* für Feld-Matrix */
  48. #define NOT_OCCUPIED 20
  49. /* Werte für check_move(): Gründe, warum gewünschter Zug ungültig */
  50. #define DIST_EXCEEDED 1
  51. #define MUST_MOVE_FARTHER 2
  52. #define WAY_BLOCKED 4
  53. #define CANT_BEAT_BUDDY 8
  54. #define KING_IN_DANGER 16
  55. /* Bei gültigem Zug gibt check_move() zurück, in welche Richtung erst gezogen
  56.    werden sollte (muß) */
  57. #define MOVE_X_FIRST 128
  58. #define MOVE_Y_FIRST 256
  59. /* Werte für do_move(): Spezialsituation nach einem Zug (Check, Matt) */
  60. #define ENEMY_KING_BEATABLE 1
  61. #define ENEMY_MATED 2
  62. #define ENEMY_OUT_OF_KNIGHTS 4
  63. #define ENEMY_KNIGHT_BEATEN  8
  64.  
  65. /* für Undo/Redo */
  66. #define MAXUNDO 500
  67. #define NOBODY  20
  68.  
  69. #define ABS(x) ((x)<0 ? -(x) : (x))
  70.  
  71. /* board */
  72. #define STD_NORM 0
  73. #define STD_ROTD 1
  74. #define RND_BAL  2
  75. #define RND_UNB  3
  76.  
  77. /* status */
  78. #define IDLE 0             /* kein Spiel im Gange */
  79. #define IN_GAME 1          /* Spiel läuft */
  80. #define PLAYER1_TO_MOVE 2  /* wenn dieses Bit gesetzt ist, ist Spieler 1 dran */
  81. #define WAITING_FOR_PICK 4 /* Der Computer erwartet, daß der Stein gewählt wird,
  82.                               der ziehen soll */
  83. #define WAITING_FOR_DEST 8 /* Nun soll das Zugziel gewählt werden */
  84. #define WAITING_FOR_CONF 16 /* Im Show...Values-Modus ist der Probezug
  85.                               gemacht und muß nun bestätigt werden */
  86. #define BOARD_UNTOUCHED 32 /* Brett ist noch nicht benutzt worden */
  87.  
  88. /* help */
  89. #define NOHELP 0
  90. #define SHOWKNOWN 1
  91. #define SHOWALL 2
  92. /* misc */
  93. #define RED FALSE
  94. #define WHITE TRUE
  95.  
  96. #define SWITCHSIDENR (SHIFTMENU(2)+SHIFTITEM(6)+SHIFTSUB(NOSUB))
  97.  
  98. /* Prototypes
  99.  * joymouse.c */
  100. void swapjoymouse(BOOL what);
  101. struct InputEvent *JoyMouseHandler(struct InputEvent *Event, ULONG *Data);
  102. /* openclose.c */
  103. void errorstop(char *message);
  104. void open_all(void);
  105. void close_all(void);
  106. /* display.c */
  107. void DrawRect(ULONG Color, ULONG DrMd, ULONG fromx, ULONG fromy, ULONG tox,
  108.      ULONG toy);
  109. void DrawLine(ULONG Color, ULONG DrMd, ULONG fromx, ULONG fromy, ULONG tox,
  110.      ULONG toy);
  111. void FillRect(ULONG Color, ULONG fromx, ULONG fromy, ULONG tox, ULONG toy);
  112. void DrawText(ULONG Color, ULONG DrMd, ULONG x, ULONG y, char *string);
  113. void drawboard(void);
  114. void drawplayers(char *Name1, char *Name2);
  115. void SetPiece(struct Piece Which, BOOL FadeIn, BOOL StayBlend);
  116. void MovePiece(UBYTE x, UBYTE y, int xdist, int ydist, BOOL FadeOut);
  117. void Highlight(UBYTE x, UBYTE y);
  118. /* board.c */
  119. void setup_stdboard(BOOL Rotated);
  120. void setup_rndboard(BOOL Balanced);
  121. UBYTE GetValue(int Num, UBYTE x, UBYTE y);
  122. UBYTE IsOccupied(UBYTE x, UBYTE y);
  123. void InitPiece(int Num, int ID, int Val, UBYTE x, UBYTE y);
  124. void clear_board(void);
  125. /* moves.c */
  126. int check_move(UBYTE board[][8], struct Piece *Pieces, int Num,
  127.                UBYTE tox, UBYTE toy);
  128. int how_to_move(UBYTE board[][8],
  129.                 UBYTE fromx, UBYTE fromy, UBYTE tox, UBYTE toy);
  130. int check_check(UBYTE board[][8], struct Piece *Pieces, int Num,
  131.                UBYTE tox, UBYTE toy);
  132. int do_move(UBYTE board[][8], struct Piece *Pieces, int Num,
  133.             UBYTE tox, UBYTE toy, BOOL x_first);
  134. BOOL undo(void);
  135. BOOL redo(void);
  136. /* disk.c */
  137. void FileError(int Error);
  138. BOOL checkrange(int Var, int lo, int hi);
  139. void SaveGame(void);
  140. void LoadGame(void);
  141. /* misc.c */
  142. void Rules(void);
  143. void ExplainError(int Error);
  144. void About(void);
  145. void SetJMSpeed(void);
  146. void EnterNames(void);
  147. BOOL Coords(SHORT MouseX, SHORT MouseY, UBYTE *x, UBYTE *y);
  148. void Exchange(UBYTE *a, UBYTE *b);
  149. void Notify(int Nr, int occurrence);
  150. void NextPlayer(BOOL who);
  151. /* main.c */
  152. void main(void);
  153. void wait_events(void);
  154. void handle_menuevents(void);
  155. void handle_mouseevents(void);
  156.